*********************************
*** JOP paper: Historical memory and radical right voting: VOX and the legacy of Francoism
*** Anja Neundorf and Sergi Pardos Prado
*** Do-file: DATA ANALYES MAIN PAPER
*** Analysis + Data Analsis VOX Paper
*** Created: 21/02/2022
*** Last updated: 21/03/2024

*** Operating system: MacOS Sonoma 14.4 
*** Statistical software: Stata MP 18.0 for Mac


clear all
capture log close

set scheme plotplain

log using "Appendix.log", replace
 

*** SET DIRECTORY WHERE FILES ARE SAVED. THIS NEEDS TO BE CHANGED!!!

global		main "/Users/anja.neundorf/Library/CloudStorage/Dropbox/Project_Populism/Vox/Analysis/Replication"
global results "${main}/tables/"
global 		graphs 			"${main}/graphs/"

cd "${main}"

** Recode raw data
do "Vox_DataPrep.do" 

** Call prepared data
use "Spain_Vox_recoded.dta", clear

*-------------------
*** Defining globals

global controls age female i.educ polint income i.b4.domicile
global vox  vote_3 vox_sup vote_vox_right
global ptv ptv_1 ptv_2 ptv_3 ptv_4 ptv_5
global outcomes_main support donate
global outcomes demimp01 autoc_dum 

*-------------------
*** APPENDIX 1: Facebook ads

// Table A.1: Number of respondents recruited by each ad, by VOX support
tab ads vox_sup, col


*-------------------
*** APPENDIX 2: CHECKING FOR NUMBERS OF COMPLETED SURVETS

// Table A.2: Finished at least 90% of survey, which includes all relevant questions
sum Progress
tab treat vox_sup if Progress>90
tab treat vote_3 if Progress>90


** Additional 
tab Finished vox_sup, col

tab treat vox_sup if Finished==1
tab treat Finished, row
bys vox_sup: tab treat Finished, row

bys vox_sup: sum Progress
bys treat: sum Progress



** ----------------------------------------------------
** APPENDIX 3: DESCRIPTIVES

// Table A.3: Summary descriptives of all variables
sum $vox $ptv $outcomes_main $outcomes $controls 
sum i.domicile


// Figure A.2: Support for public funds by VOX-support by treatment
** Descriptively explore support variable 

bys treat vox_sup: sum support


** Prado
twoway(kdensity support if treat==0 & vox_sup==1, lc(black) lp(solid))(kdensity support if treat==0 & vox_sup==0, lc(gs6) lp(dash)), xline(3.1, lc(black) lp(solid)) xline(4.0, lc(gs6) lp(dash)) title("Museum Prado Foundation", size(large)) xtitle(" ") ylabel(, labsize(medlarge)) xlabel(, labsize(medsmall)) ytitle(, size(medsmall)) legend(off) name(prado, replace)

** Franco
twoway(kdensity support if treat==1 & vox_sup==1, lc(black) lp(solid))(kdensity support if treat==1 & vox_sup==0, lc(gs6) lp(dash)), xline(2.9, lc(black) lp(solid)) xline(1.3, lc(gs6) lp(dash)) title("Franco Foundation", size(large)) xtitle(" ") ylabel(, labsize(medlarge)) xlabel(, labsize(medsmall)) ytitle(, size(medsmall)) legend(lab(1 "VOX supporters") lab(2 "Non-VOX supporters") size(medlarge) order(1 2) row(1) region(lcolor(white)) pos(2) ring(0)) name(franco, replace)


* Catalan
twoway(kdensity support if treat==2 & vox_sup==1, lc(black) lp(solid))(kdensity support if treat==2 & vox_sup==0, lc(gs6) lp(dash)), xline(1.2, lc(black) lp(solid)) xline(3.0, lc(gs6) lp(dash)) title("Pro-Catalan Foundation", size(large)) xtitle(" ") ylabel(, labsize(medlarge)) xlabel(, labsize(medsmall)) ytitle(, size(medsmall)) legend(off) name(catalan, replace)

* Immigration
twoway(kdensity support if treat==3 & vox_sup==1, lc(black) lp(solid))(kdensity support if treat==3 & vox_sup==0, lc(gs6) lp(dash)), xline(2.1, lc(black) lp(solid)) xline(4.8, lc(gs6) lp(dash)) title("Pro-Immigration Foundation", size(large)) xtitle(" ") ylabel(, labsize(medlarge)) xlabel(, labsize(medsmall)) ytitle(, size(medsmall)) legend(off) name(immig, replace)

* Feminism
twoway(kdensity support if treat==4 & vox_sup==1, lc(black) lp(solid))(kdensity support if treat==4 & vox_sup==0, lc(gs6) lp(dash)), xline(1.4, lc(black) lp(solid)) xline(4.3, lc(gs6) lp(dash)) title("Pro-Feminism Foundation", size(large)) xtitle(" ") ylabel(, labsize(medlarge)) xlabel(, labsize(medsmall)) ytitle(, size(medsmall)) legend(off) name(femin, replace)

* Union
twoway(kdensity support if treat==5 & vox_sup==1, lc(black) lp(solid))(kdensity support if treat==5 & vox_sup==0, lc(gs6) lp(dash)), xline(1.4, lc(black) lp(solid)) xline(3.7, lc(gs6) lp(dash)) title("Pro-Trade Union Foundation", size(large)) xtitle(" ") ylabel(, labsize(medlarge)) xlabel(, labsize(medsmall)) ytitle(, size(medsmall)) legend(off) name(union, replace)

graph combine prado franco catalan immig femin union //, xsize(10) ysize(5)
graph save  "${graphs}FigureA.2_support_descriptive.gph",  replace
graph export  "${graphs}FigureA.2_support_descriptive.pdf", as(pdf) replace



// Figure A.3: Distribution of Vote Intention for VOX

tab ptv_3
hist ptv_3, xlabel(1(1)10) percent
graph save  "${graphs}FigureA.3_VOX-PTV.gph",  replace
graph export  "${graphs}FigureA.3_VOX-PTV.pdf", as(pdf) replace


** ----------------------------------------
** APPENDIX 4: Balance test

capture erase "${results}TableA.4_Results_balance.xls"
capture erase "${results}TableA.4_Results_balance.txt"

capture erase "${results}TableA.5_Results_balance.xls"
capture erase "${results}TableA.5_Results_balance.txt"

capture erase "${results}TableA.6_Results_balance.xls"
capture erase "${results}TableA.6_Results_balance.txt"

capture erase "${results}TableA.7_Results_balance.xls"
capture erase "${results}TableA.7_Results_balance.txt"

capture erase "${results}TableA.8_Results_balance.xls"
capture erase "${results}TableA.8_Results_balance.txt"

// Table A.4: Balance test: Full sample


mlogit treat $controls, base(0)
	estimates store M1_all
outreg2  using "${results}TableA.4_Results_balance.xls", ///
bracket bdec(3) sdec(3) append

// Table A.5: Balance test: VOX voters

mlogit treat $controls  if vote_3==1, base(0)
	estimates store M1_vox
outreg2  using "${results}TableA.5_Results_balance.xls", ///
bracket bdec(3) sdec(3) append


// Table A.6: Balance test: VOX supporters

mlogit treat $controls  if vox_sup==1, base(0)
	estimates store M1_vox
outreg2  using "${results}TableA.6_Results_balance.xls", ///
bracket bdec(3) sdec(3) append

// Table A.7: Balance test: Non-VOX voters

tab vote_3

mlogit treat $controls  if vote_3==0, base(0)
	estimates store M1_vox
outreg2  using "${results}TableA.7_Results_balance.xls", ///
bracket bdec(3) sdec(3) append

// Table A.8: Balance test: VOX vs right-wing voters
mlogit treat $controls  if vote_vox_right!=., base(0)
	estimates store M1_vox
outreg2  using "${results}TableA.8_Results_balance.xls", ///
bracket bdec(3) sdec(3) append


** ----------------------------------------------------------
** APPENDIX 5: Coefficients Figure 1 

capture erase "${results}TableA.9_coef_subsample.xls"
capture erase "${results}TableA.9_coef_subsample.txt"


foreach k of varlist  vote_3 vox_sup {
reg support i.treat female i.educ if `k'==1
estimates store M1_`k'
outreg2  using "${results}TableA.9_coef_subsample.xls", ///
bracket bdec(3) sdec(3) append label word 

reg donate i.treat female i.educ  if `k'==1 
estimates store M2_`k'
outreg2  using "${results}TableA.9_coef_subsample.xls", ///
bracket bdec(3) sdec(3) append label word 
}

foreach k of varlist  vote_3 {
reg support i.treat polint if `k'==0
estimates store M4_`k'
outreg2  using "${results}TableA.9_coef_subsample.xls", ///
bracket bdec(3) sdec(3) append label word 

reg donate i.treat polint  if `k'==0 
estimates store M3_`k'
outreg2  using "${results}TableA.9_coef_subsample.xls", ///
bracket bdec(3) sdec(3) append label word 

}



** ----------------------------------------------------------
** APPENDIX 6:  Replicating Table 1, using VOX (PTV) support and donations instead of VOX vote

capture erase "${results}TableA.10_app_support.xls"
capture erase "${results}TableA.10_app_support.txt"

// Table A.10: Main results: Vox support and treatments (FULL SAMPLE)

foreach k of varlist vox_sup {
reg support i.treat##i.`k' polint 
estimates store M1_`k'
outreg2  using "${results}TableA.10_app_support.xls", ///
bracket bdec(3) sdec(3) append label word 

reg donate i.treat##i.`k' polint 
estimates store M2_`k'
outreg2  using "${results}TableA.10_app_support.xls", ///
bracket bdec(3) sdec(3) append label word 

}


// Table A.11: Using PTV instead of binary support variables

capture erase "${results}TableA.11_PTV_support.xls"
capture erase "${results}TableA.11_PTV_support.txt"

foreach k of varlist $ptv {
reg support i.treat##c.`k' polint
estimates store M1_`k'
outreg2  using "${results}TableA.11_PTV_support.xls", ///
bracket bdec(3) sdec(3) append label word 


reg donate i.treat##c.`k' polint
estimates store M1_`k'
outreg2  using "${results}TableA.11_PTV_support.xls", ///
bracket bdec(3) sdec(3) append label word 

}


** ----------------------------------------------------------
** APPENDIX 7: Robustness tests: Additional model specifications

corr vote_3 vox_sup ptv_3

capture erase "${results}TableA.12_main_support_robust.xls"
capture erase "${results}TableA.12_main_support_robust.txt"

capture erase "${results}TableA.13_main_donate_robust.xls"
capture erase "${results}TableA.13_main_donate_robust.txt"

// Table A.12: Additional specifications. Outcome: Attitudinal support
// Table A.13: Additional specifications. Outcome: Donation

foreach k of varlist vote_3 vox_sup {
reg support i.treat##i.`k' 
estimates store M1_`k'
outreg2  using "${results}TableA.12_main_support_robust.xls", ///
bracket bdec(3) sdec(3) append label word 

reg donate i.treat##i.`k'
estimates store M2_`k'
outreg2  using "${results}TableA.13_main_donate_robust.xls", ///
bracket bdec(3) sdec(3) append label word 


reg support i.treat##i.`k'  $controls
estimates store M3_`k'
outreg2  using "${results}TableA.12_main_support_robust.xls", ///
bracket bdec(3) sdec(3) append label word 

reg donate i.treat##i.`k' $controls
estimates store M4_`k'
outreg2  using "${results}TableA.13_main_donate_robust.xls", ///
bracket bdec(3) sdec(3) append label word 

reg support i.treat##i.`k' polint i.region
estimates store M5_`k'
outreg2  using "${results}TableA.12_main_support_robust.xls", ///
bracket bdec(3) sdec(3) append label word 

reg donate i.treat##i.`k' polint i.region
estimates store M6_`k'
outreg2  using "${results}TableA.13_main_donate_robust.xls", ///
bracket bdec(3) sdec(3) append label word 

reg support i.treat##i.`k' polint i.ads
estimates store M7_`k'
outreg2  using "${results}TableA.12_main_support_robust.xls", ///
bracket bdec(3) sdec(3) append label word 

reg donate i.treat##i.`k' polint i.ads
estimates store M8_`k'
outreg2  using "${results}TableA.13_main_donate_robust.xls", ///
bracket bdec(3) sdec(3) append label word 

}

sum $controls

** ----------------------------------------------------------
** APPENDIX 8: Cohort results: Coefficients and additional results
tab birth 


// Table A.14: Full results for Figure 3 (coefficients and standard errors)
capture erase "${results}TableA.14_main_support_cohort.xls"
capture erase "${results}TableA.14_main_support_cohort.txt"

reg support i.treat##i.vote_3##c.birth polint 
outreg2  using "${results}TableA.14_main_support_cohort.xls", ///
bracket bdec(3) sdec(3) append label word alpha(0.01, 0.05)


// Figure A.4: Franco treatment effects by cohorts

capture drop cohort_cat
tab birth
recode birth (1944/1955=1 "Franco") (1956/1969=2 "Transition") (1970/2004=3 "Democratic"), gen(cohort_cat)
tab cohort_cat vote_3 if treat<2, row  // Vox voters in treatment: 21 Franco coh, 67 transition cohort, 117 post-Franco coh


reg support i.treat##i.vote_3##i.cohort_cat polint 
*tab vote_3 if e(sample)

margins,  at(treat= 1  cohort_cat=(1 2 3) vote_3 =(0(1)1))  
marginsplot, ///
yline(3.5) xtitle("Cohort", size(medlarge)) ylabel(1(1)6, labsize(medium)) xlabel(, labsize(medium) angle(45)) ytitle(Predicted support for Franco Foundation, size(medlarge)) recastci(rspike) recast(scatter)  legend(lab(3 "Non-VOX voters") lab(4 "VOX voters") size(medlarge) order(3 4 ) row(1) region(lcolor(white)) pos(2) ring(0)) title(" ")
graph save  "${graphs}FigureA.4_Voxvote_pred_coh_cat.gph",  replace
graph export  "${graphs}FigureA.4_Voxvote_pred_coh_cat.pdf", as(pdf) replace


// Figure A.5: Franco treatment effects by birth cohorts for VOX and PP voters
tab vote2019
tab vote2019, nolabel

sum support if treat==1

capture drop vote_new
recode vote2019 (1=0) (2=1 "PP") (3=2 "VOX") (4/16=0 "Other"), gen(vote_new)
tab vote2019 vote_new

reg support i.treat##i.vote_new##c.birth polint 

margins,  at(treat= 1  birth=(1945(1)2000) vote_new =(0(1)2))  
marginsplot, ///
yline(3.5) xtitle("Birth year", size(medlarge)) ylabel(1(1)6, labsize(medium)) xlabel(1945(5)2000, labsize(medium) angle(45)) ytitle(Predicted support for Franco Foundation, size(medlarge)) recastci(rspike) recast(scatter)  legend(lab(4 "Other voters") lab(5 "PP voters") lab(6 "VOX voters") size(medlarge) order( 4 5 6 ) row(1) region(lcolor(white)) pos(2) ring(0)) title(" ")
graph save  "${graphs}FigureA.5_VoxPPvote_pred_coh_cont.gph",  replace
graph export  "${graphs}FigureA.5_VoxPPvote_pred_coh_cont.pdf", as(pdf) replace


** ----------------------------------------------------------
** APPENDIX 9: Main effects of treatments

capture erase "${results}TableA.15_main_effects.xls"
capture erase "${results}TableA.15_main_effects.txt"

// Table A.15: Main effects of treatments
reg support i.treat female i.educ
outreg2  using "${results}TableA.15_main_effects.xls", ///
bracket bdec(3) sdec(3) append label word alpha(0.01, 0.05)

reg donate i.treat female i.educ
outreg2  using "${results}TableA.15_main_effects.xls", ///
bracket bdec(3) sdec(3) append label word alpha(0.01, 0.05)


** ----------------------------------------------------------
** APPENDIX 10: VOX support and overt support for democracy


// Table A.16: Percentage agreeing with democracy statements
bys vote_3: sum autoc_dum demimp01


// Table A.17: Regression results of overt democracy support variables
capture erase "${results}TableA.17_main_support_democ.xls"
capture erase "${results}TableA.17_main_support_democ.txt"

reg autoc_dum vote_3 $controls, b // add standadized beta coef.
*outreg2  using "${results}TableA.17_main_support_democ.xls", bracket bdec(3) sdec(3) append label word alpha(0.01, 0.05) 
// The outreg command for this model does not work and results were included manually in the table.

reg demimp01 vote_3 $controls
outreg2  using "${results}TableA.17_main_support_democ.xls", bracket bdec(3) sdec(3)  append label word alpha(0.01, 0.05)

reg demimp01 vote_3 $controls, b // add standadized beta coef.
outreg2  using "${results}TableA.17_main_support_democ.xls", bracket bdec(3) sdec(3) stats(beta) append label word alpha(0.01, 0.05)


// Table A.18: Treatment effects x VOX vote for different samples of democracy support. Outcome: Atti- tudinal Support for organization

capture erase "${results}TableA.18_treat_support_democ.xls"
capture erase "${results}TableA.18_treat_support_democ.txt"

foreach k of varlist vote_3 {
reg support i.treat##i.`k' polint if autoc_dum==0
estimates store M1_`k'
outreg2  using "${results}TableA.18_treat_support_democ.xls", ///
bracket bdec(3) sdec(3) append label word alpha(0.01, 0.05)

reg support i.treat##i.`k' polint if autoc_dum==1
estimates store M1_`k'
outreg2  using "${results}TableA.18_treat_support_democ.xls", ///
bracket bdec(3) sdec(3) append label word alpha(0.01, 0.05)
}

sum demimp, d

foreach k of varlist vote_3 {
reg support i.treat##i.`k' polint if demimp <=3
estimates store M1_`k'
outreg2  using "${results}TableA.18_treat_support_democ.xls", ///
bracket bdec(3) sdec(3) append label word alpha(0.01, 0.05)

reg support i.treat##i.`k' polint if demimp >3
estimates store M1_`k'
outreg2  using "${results}TableA.18_treat_support_democ.xls", ///
bracket bdec(3) sdec(3) append label word alpha(0.01, 0.05)

}


// Table A.19: Average attitudinal support for Franco (treated group)

bys autoc_dum: sum support  if vote_3==1 & treat==1
bys autoc_dum: sum support  if vote_3==0 & treat==1



** ----------------------------------------------------------
** APPENDIX 11: Representative data on VOX voters and support for Franco

use "cis_survey.dta", clear

/* keeping only relevant variables from CIS data and renaming variables

 keep B19 B19A B22 ESTUDIOS C10 C9 C19
 lab var B19 "Did Franco exhumation affect vote?"
 lab var B19A "How did Franco exhumation affect vote?"
 lab var B22 "Vote recall 2019 general election"
 lab var  ESTUDIOS "Education highest degree"
 lab var C10 "Age"
 lab var  C9 "Gender"
 lab var C19 "Household income"
 */

 
// Recoding CIS data

tab B19 /*Did the exhumation of Franco's remnants have any influence on your vote (yes vs no)*/
recode B19 1=1 2=0 else=., gen(franco_influence)

tab B19A
recode B19A 5/.=., gen(franco_direction) /*for those who did have an influence: 1-reaffirmed vote choice; 2- changed vote choice; 3- led to participation; 4- led to abstention*/

*For those who answered "changed vote choice" in previous question there is a follow-up on which party were you thinking of voting (B19B) but has too few cases.

// Vote recall
recode B22 1=1 2=2 18=3 4=4 67=5 21=5 6=5 67=5 else=., gen(vote_recall)
lab def vote 1"PP" 2"PSOE" 3"VOX" 4"Ciudadanos" 5"Podemos"
lab val vote_recall vote 

// Control variables
recode vote_recall 3=1 else=0, gen(vox_else)
recode ESTUDIOS 7/.=., gen(education)
rename C10 age
recode C9 2=1 1=0, gen(female)
recode C19 98/.=., gen(hh_income)

tab education
tab ESTUDIOS

***** 
*Analysis discussed in appendix

tab  vote_recall franco_influence, row
bys vote_recall: tab franco_influence
bys vote_recall: tab franco_direction


// Table A.20: Linear regression predicting VOX vote in the 2019 Spanish election

capture erase "${results}TableA.20_coef_CIS.xls"
capture erase "${results}TableA.20_coef_CIS.txt"

reg vox_else franco_influence
outreg2  using "${results}TableA.20_coef_CIS.xls", bdec(3) sdec(3) append bracket alpha(0.01, 0.05)

reg vox_else franco_influence ib1.education age female hh_income, b
outreg2  using "${results}TableA.20_coef_CIS.xls", ///
bracket bdec(3) sdec(3) append alpha(0.01, 0.05)


log close
